//
// * Copyright (c) 2002-2009 "Neo Technology,"
// *     Network Engine for Objects in Lund AB [http://neotechnology.com]
// *
// * This file is part of Neo4j.
// * 
// * Neo4j is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Affero General Public License as
// * published by the Free Software Foundation, either version 3 of the
// * License, or (at your option) any later version.
// * 
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// * GNU Affero General Public License for more details.
// * 
// * You should have received a copy of the GNU Affero General Public License
// * along with this program. If not, see <http://www.gnu.org/licenses/>.
// 
namespace org.neo4j.kernel.impl.persistence
{

	using XAResource = javax.transaction.xa.XAResource;

	using PropertyIndex = org.neo4j.kernel.impl.core.PropertyIndex;
	using PropertyData = org.neo4j.kernel.impl.nioneo.store.PropertyData;
	using PropertyIndexData = org.neo4j.kernel.impl.nioneo.store.PropertyIndexData;
	using RelationshipChainPosition = org.neo4j.kernel.impl.nioneo.store.RelationshipChainPosition;
	using RelationshipData = org.neo4j.kernel.impl.nioneo.store.RelationshipData;
	using RelationshipTypeData = org.neo4j.kernel.impl.nioneo.store.RelationshipTypeData;
	using ArrayMap = org.neo4j.kernel.impl.util.ArrayMap;

///
/// <summary> * A connection to a <seealso cref="PersistenceSource"/>. <CODE>ResourceConnection</CODE>
/// * contains operations to retrieve the <seealso cref="javax.transaction.xa.XAResource"/>
/// * for this connection and to close the connection, optionally returning it to a
/// * connection pool. </summary>
/// 
	public interface ResourceConnection
	{
///    
///     <summary> * Returns the <seealso cref="javax.transaction.xa.XAResource"/> that represents this
///     * connection. </summary>
///     * <returns> the <CODE>XAResource</CODE> for this connection </returns>
///     
		XAResource getXAResource();

		void destroy();

		void nodeDelete(int nodeId);

		int nodeAddProperty(int nodeId, PropertyIndex index, object value);

		void nodeChangeProperty(int nodeId, int propertyId, object value);

		void nodeRemoveProperty(int nodeId, int propertyId);

		void nodeCreate(int id);

		void relationshipCreate(int id, int typeId, int startNodeId, int endNodeId);

		void relDelete(int relId);

		int relAddProperty(int relId, PropertyIndex index, object value);

		void relChangeProperty(int relId, int propertyId, object value);

		void relRemoveProperty(int relId, int propertyId);

		bool nodeLoadLight(int id);

		object loadPropertyValue(int id);

		string loadIndex(int id);

		PropertyIndexData[] loadPropertyIndexes(int maxCount);

		ArrayMap<int, PropertyData> nodeLoadProperties(int nodeId);

		ArrayMap<int, PropertyData> relLoadProperties(int relId);

		RelationshipData relLoadLight(int id);

		RelationshipTypeData[] loadRelationshipTypes();

		void createPropertyIndex(string key, int id);

		void createRelationshipType(int id, string name);

		RelationshipChainPosition getRelationshipChainPosition(int nodeId);

		IEnumerable <RelationshipData> getMoreRelationships(int nodeId, RelationshipChainPosition position);
	}
}